<?php defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

/* JoomLeague League Management and Prediction Game for Joomla!
 * @version $Id$
 * @package Joomleague
 * @copyright Copyright (C) 2007  JoomLeague
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see _joomleague_license.txt
 *  
 * Homepage: http://www.joomleague.de
 * Support: htt://www.joomleague.de/forum/
 * 
 * This file is part of JoomLeague.
 *  
 * JoomLeague is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * Please note that the GPL states that any headers in files and
 * Copyright notices as well as credits in headers, source files
 * and output (screens, prints, etc.) can not be removed.
 * You can extend them with your own credits, though...
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * The "GNU General Public License" (GPL) is available at
 * http://www.gnu.org/copyleft/gpl.html.
*/ 


class JLTabs
{	
    /** @var int Use cookies */
    var $useCookies = 0;
  
   /**
    * Constructor
    * Includes files needed for displaying tabs and sets cookie options
    * @param int useCookies, if set to 1 cookie will hold last used tab between page refreshes
    */
    function JLTabs( $useCookies, $xhtml=NULL, $css_abs_path = NULL ) {
        global $mosConfig_live_site, $mainframe;

        if ( $css_abs_path == NULL )
        {
        	$css_abs_path = _JOOMLA_JL_LIVE_SITE.'/components/com_joomleague/css/joomleague_tabs.css';
        }
        if ( $xhtml ) {
            $mainframe->addCustomHeadTag( '<link rel="stylesheet" type="text/css" media="all" href="' . $css_abs_path. '" id="joomleague-tab-style-sheet" />' );
        } else {
            echo "<link id=\"joomleague-tab-style-sheet\" type=\"text/css\" rel=\"stylesheet\" href=\"" . $css_abs_path. "\" />";
        }

        echo "<script type=\"text/javascript\" src=\"". $mosConfig_live_site . "/includes/js/tabs/tabpane_mini.js\"></script>";

        $this->useCookies = $useCookies;
    }
    
	  /**
	  * creates a tab pane and creates JS obj
	  * @param string The Tab Pane Name
	  */
	  function startPane($id){
	    echo "<div class=\"tab-page\" id=\"".$id."\">";
	    echo "<script type=\"text/javascript\">\n";
	    echo "  var tabPane1 = new WebFXTabPane( document.getElementById( \"".$id."\" ), ".$this->useCookies." )\n";
	    echo "</script>\n";
	  }
	
	  /**
	  * Ends Tab Pane
	  */
	  function endPane() {
	    echo "</div>";
	  }
	
	  /*
	  * Creates a tab with title text and starts that tabs page
	  * @param tabText - This is what is displayed on the tab
	  * @param paneid - This is the parent pane to build this tab on
	  */
	  function startTab( $tabText, $paneid ) {
	    echo "<div class=\"tab-page\" id=\"".$paneid."\">";
	    echo "<h2 class=\"tab\">".$tabText."</h2>";
	    echo "<script type=\"text/javascript\">\n";
	    echo "  tabPane1.addTabPage( document.getElementById( \"".$paneid."\" ) );";
	    echo "</script>";
	  }
	
	  /*
	  * Ends a tab page
	  */
	  function endTab() {
	    echo "</div>";
	  }
}
?>
